package router

import (
	"todolist/app/controller"
	"todolist/setting"

	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine {
	if setting.Conf.Release {
		gin.SetMode(gin.ReleaseMode)
	}
	r := gin.Default()

	todoRouter := r.Group("todo")

	todoRouter.POST("/add", controller.CreateTodo)
	todoRouter.GET("/get", controller.GetTodoList)
	todoRouter.PUT("/edit/:id", controller.UpdateTodu)
	todoRouter.DELETE("/del/:id", controller.DeleteTodo)

	return r
}
